import QtQuick 2.9

Item {
    id: container

    function show(message) {
        txtMessage.text = message

        //...start animation
        tmrHide.restart()
        _y = 0
    }

    //---------------------------------------- ANIMATION ----
    property int _y: container.height
    Behavior on _y { PropertyAnimation { duration: 300 } }
    Timer {
        id: tmrHide
        interval: 2300
        repeat: false

        onTriggered: _y = container.height
    }

    ///////////////////////////////////////////////// UI ////

    Rectangle {
        id: body
        width: container.width
        height: container.height
        y: _y
        color: "#222"

        Text {
            id: txtMessage
            anchors.fill: parent
            anchors.leftMargin: parent.width * 0.02
            verticalAlignment: Text.AlignVCenter
            color: "#e1e1e1"
            font.pixelSize: parent.height * 0.45
        }
    }
}
